<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>功能模块管理</title>
    <%@ include file="../au_inc.jsp" %>
    
	<script type="text/javascript">
	//所有的子窗体都需要有一个save函数，当点击弹出窗体的保存按钮时所进行的操作
	function btnSave_click()
	{
	    var fun_ret = false;
	
	   var vals =$('#formModule').serialize();
	   var url = '${baseUrl }/admin/modules/save';
	   var valid = $('#formModule').form('validate');
	   if(valid){
		   $.ajax({
		       async: false, 
		       type: "POST", 
		       url : url,
		       data:vals,
		       cache:false,
		       dataType : 'json', 
		       success : function(data) { 
		           if(data.success!=0)
		           {
		               top.Ext.Msg.alert("提示",data.msg);
		           }
		           else
		           {
		               fun_ret = true;
		           }
		       } 
		   });
	   }
	   return fun_ret;
	}
	
    function type_change()
    {
        var type = $('#type').val();
        var id = $('#id').val();
        if(type==1)
        {
            $('#url').attr("disabled",true);
            $('#btnModules').attr("disabled",true);
            $('#pid').val("")
            $('#pname').val("");
        }
        else
        {
            $('#url').removeAttr("disabled");
            $('#btnModules').removeAttr("disabled");
            $('#pname').combobox({    
                url:'${baseUrl}/admin/modules/select_mod?type='+type+"&id="+id,    
                valueField:'id',    
                textField:'text'   
            });  
        }
    }
    $(document).ready(function(){
        type_change();
    });
	</script>
  </head>
  <body>
		<div style="padding:1px">
	    <form id="formModule" method="post" autocomplete="off">
	    	<input id="id" type="hidden" name="modules.id" value="${modules.id }">
	    	<%-- <input id="pid" type="hidden" name="modules.parent_id" value="${modules.parent_id }"> --%>
	    	<table border="0" cellpadding="2" >
                <tr>
                    <td>模块类型：</td>
                    <td><select id="type" name="modules.type" onchange="type_change()">
                            <option value="1" <c:if test="${modules.type==1}">selected</c:if>>菜单组</option>
                            <option value="2" <c:if test="${modules.type==2}">selected</c:if>>菜单项</option>
                            <option value="3" <c:if test="${modules.type==3}">selected</c:if>>菜单功能</option>
                        </select></td>
                </tr>
	    		<tr>
	    			<td width="70">上级菜单：</td>
	    			<%-- <td><input id="pname" class="easyui-textbox" type="text" name="pname" style="width:160px" value="${pname }" readonly="readonly"></input><input id="btnModules" type="button" onclick="btnModules_click();" value="模块"></td> --%>
	    			<td><input id="pname" class="easyui-combobox" type="text" name="modules.parent_id" data-options="valueField:'id',textField:'text',panelHeight:'100',editable:false " style="width:200px" value="${modules.parent_id}" ></input></td>
	    		</tr>
	    		<tr>
	    			<td>菜单名称：</td>
	    			<td><input id="name" class="easyui-validatebox textbox" type="text" name="modules.name" data-options="required:true" style="width:200px" value="${modules.name }"></input></td>
	    		</tr>
	    		<tr>
	    			<td>链接地址：</td>
	    			<td><input id="url" class="textbox" type="text" name="modules.url" style="width:200px" value="${modules.url }"></input></td>
	    		</tr>
	    		<tr>
	    			<td>显示顺序：</td>
	    			<td><input id="showOrder" class="textbox" type="text" name="modules.show_order"  value="${modules.show_order }"></input></td>
	    		</tr>
	    		<tr>
	    			<td>显示图标：</td>
	    			<td><input id="img" type="text" name="modules.img" value="${modules.img }"></input></td>
	    		</tr>
	    		<tr>
	    			<td>状态：</td>
	    			<td><select id="status" name="modules.status">
	    					<option value="9" <c:if test="${modules.status==9}">selected</c:if>>启用</option>
	    					<option value="0" <c:if test="${modules.status==0}">selected</c:if>>禁用</option>
	    				</select></td>
	    		</tr>
	    	</table>
	    </form>
	    </div>
  </body>
</html>
